package org.nmgyjt.springboot.entity.organization;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

@Data
@Accessors(chain = true)
@TableName("organization")
public class Organization {
    String id;
    @JSONField(serialize = false)
    String code;

    String name;

    @JSONField(serialize = false)
    String parentId;

    @JSONField(serialize = false)
    String status;

    @TableField(exist = false)
    List<Organization> children = new ArrayList<>();

    public void addTreeNode(Organization node){
        children.add(node);
    }
}
